package com.itheima.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itheima.pojo.BsUser;
import com.itheima.pojo.PePermission;
import com.itheima.pojo.PePermissionGroup;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import javax.websocket.server.PathParam;
import java.util.List;

@Repository
public interface LoginMapper extends BaseMapper<BsUser> {

    @Insert("Insert into token values (null,#{token},#{bsuserid})")
    void savetoken(@Param("bsuserid") Integer id , @Param("token") String token);
    @Select("select bs_user_id from token where token= #{admintoken}")
    Integer selectprofig(String admintoken);
    @Select("select pid from a_permission_permission_group where pgid=#{groupid}")
    List<String> selectmenus(Long groupid);
    @Select("select * from pe_permission where id=#{permission}")
    PePermission selectPermission(String permission);
    @Delete("delete from token where token = #{s}")
    void deletetoken(String s);
    @Select("Select name from pe_permission_group where id = #{permission_group_id}")
    String selectpgi(Long permission_group_id);
    @Select("Select * from pe_permission_group")
    List<PePermissionGroup> selectpe_permission_group();
}
